package com.glsc.ngateway.platform.service.itflow.flowstrategy.systemNameModify.taskPostHandler;

import com.glsc.ngateway.common.api.flowable.dto.task.doTaskParam.system.SystemPassParamDto;
import com.glsc.ngateway.common.api.flowable.dto.task.formData.system.SystemNameModifyTaskFormDataDto;
import com.glsc.ngateway.common.api.flowable.dto.task.formData.system.domainDto.FlowFormSystemNameModifyDto;
import com.glsc.ngateway.platform.service.itflow.flowstrategy.systemNameModify.SystemNameModifyFlowStrategy;
import com.glsc.ngateway.common.base.enums.itflow.ITFlowTaskEnum;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import javax.validation.constraints.NotNull;

/**
 * 流程发起
 * @author xuchang
 */
@Component
public class SNMStep1BeginTaskPostHandlerAudit implements ISystemNameModifyTaskPostHandlerAudit {

    @Autowired
    private SystemNameModifyFlowStrategy systemNameModifyFlowStrategy;
    /**
     * 重新发起节点，调用审批流程，会调用afterHandle方法，需要加上保存保单数据的步骤
     */
    @Override
    public void passAfterHandle(@NotNull SystemPassParamDto<FlowFormSystemNameModifyDto, SystemNameModifyTaskFormDataDto> param, String operator) throws Exception {
        systemNameModifyFlowStrategy.saveOrUpdateForm(param.getFlowableFormData(), operator);
    }

    @Override
    public String getTaskDefinitionKey() {
        return ITFlowTaskEnum.SYSTEM_NAME_MODIFY_FLOW_BEGIN_TASK.getTaskKey();
    }
}
